generate_api = find_program('generate_code.py')

generated_sources = [
    'GLib_DBusServer.cs',
    'GLib_GLibSharp.AsyncReadyCallbackNative.cs',
    'GLib_DBusProxyFlags.cs',
    'GLib_GLibSharp.SettingsBindGetMappingNative.cs',
    'GLib_FileAttributeInfoFlags.cs',
    'GLib_SettingsBackendWatch.cs',
    'GLib_ResourceFileEnumerator.cs',
    'GLib_Credentials.cs',
    'GLib_AsyncResultAdapter.cs',
    'GLib_DBusError.cs',
    'GLib_DBusMessageFlags.cs',
    'GLib_FileType.cs',
    'GLib_FdoNotificationBackend.cs',
    'GLib_TlsDatabaseVerifyFlags.cs',
    'GLib_DBusMessageType.cs',
    'GLib_MenuItem.cs',
    'GLib_GLibSharp.FileProgressCallbackNative.cs',
    'GLib_DBusCallFlags.cs',
    'GLib_SocketClient.cs',
    'GLib_ZlibDecompressor.cs',
    'GLib_ActionMapAdapter.cs',
    'GLib_IOModuleScope.cs',
    'GLib_DBusSubtreeFlags.cs',
    'GLib_InputStream.cs',
    'GLib_SimpleProxyResolver.cs',
    'GLib_NetworkAddress.cs',
    'GLib_DBusObjectSkeleton.cs',
    'GLib_Socks4aProxy.cs',
    'GLib_SocketListener.cs',
    'GLib_FileDescriptorBasedAdapter.cs',
    'GLib_ActionRemovedHandler.cs',
    'GLib_Resource.cs',
    'GLib_SettingsBindFlags.cs',
    'GLib_SocketAddress.cs',
    'GLib_EmblemedIcon.cs',
    'GLib_AcceptCertificateHandler.cs',
    'GLib_MenuExporterLink.cs',
    'GLib_PropertyAction.cs',
    'GLib_TlsDatabase.cs',
    'GLib_DummyTlsCertificate.cs',
    'GLib_Socks5Proxy.cs',
    'GLib_IFileDescriptorBased.cs',
    'GLib_FileIOStream.cs',
    'GLib_DataOutputStream.cs',
    'GLib_SocketListenerEvent.cs',
    'GLib_IOSchedulerJob.cs',
    'GLib_MountRemovedHandler.cs',
    'GLib_IDatagramBased.cs',
    'GLib_IOExtension.cs',
    'GLib_AsyncInitableAdapter.cs',
    'GLib_DummyTlsConnection.cs',
    'GLib_ShowUnmountProgressHandler.cs',
    'GLib_DBusErrorEntry.cs',
    'GLib_DummyTlsCertificateClass.cs',
    'GLib_DBusAnnotationInfo.cs',
    'GLib_SocketService.cs',
    'GLib_LaunchedFailedHandler.cs',
    'GLib_ChangeEventHandler.cs',
    'GLib_MemoryBuffer.cs',
    'GLib_Win32RegistrySubkeyIter.cs',
    'GLib_FileMeasureProgressCallback.cs',
    'GLib_OutputMessage.cs',
    'GLib_DBusObject.cs',
    'GLib_DBusInterfaceSkeleton.cs',
    'GLib_ActionGroupAdapter.cs',
    'GLib_ISeekable.cs',
    'GLib_GLibSharp.PollableSourceFuncNative.cs',
    'GLib_ResourceFileInputStreamClass.cs',
    'GLib_GLibSharp.CancellableSourceFuncNative.cs',
    'GLib_NativeVolumeMonitor.cs',
    'GLib_DBusServerClass.cs',
    'GLib_DBusMenuPath.cs',
    'GLib_Win32WinsockFuncs.cs',
    'GLib_MenuExporterGroup.cs',
    'GLib_DBusPropertyInfoFlags.cs',
    'GLib_DriveDisconnectedHandler.cs',
    'GLib_UnixFDMessage.cs',
    'GLib_Win32RegistryValueIter.cs',
    'GLib_ResourceFileInputStream.cs',
    'GLib_DBusAuthObserverClass.cs',
    'GLib_ConverterAdapter.cs',
    'GLib_ShowProcessesHandler.cs',
    'GLib_ItemsChangedHandler.cs',
    'GLib_CancellableSourceFunc.cs',
    'GLib_FileProgressCallback.cs',
    'GLib_DBusSignalInfo.cs',
    'GLib_DriveStartFlags.cs',
    'GLib_CredentialsType.cs',
    'GLib_Menu.cs',
    'GLib_IOStream.cs',
    'GLib_DriveConnectedHandler.cs',
    'GLib_MenuModel.cs',
    'GLib_LocalFileEnumerator.cs',
    'GLib_ProxyAddressEnumerator.cs',
    'GLib_Win32RegistryKeyWatchCallbackFunc.cs',
    'GLib_MenuExporterWatch.cs',
    'GLib_Win32AppInfoApplication.cs',
    'GLib_FileInfo.cs',
    'GLib_ContentType.cs',
    'GLib_MountOperation.cs',
    'GLib_DriveAdapter.cs',
    'GLib_GLibSharp.SocketSourceFuncNative.cs',
    'GLib_BytesIcon.cs',
    'GLib_ThreadedSocketService.cs',
    'GLib_ThreadedResolver.cs',
    'GLib_SettingsGetMapping.cs',
    'GLib_WritableChangedHandler.cs',
    'GLib_TestDBus.cs',
    'GLib_FileMeasureFlags.cs',
    'GLib_IAsyncResult.cs',
    'GLib_DBusMethodInfo.cs',
    'GLib_TaskThreadFunc.cs',
    'GLib_IDrive.cs',
    'GLib_SettingsBackendClosure.cs',
    'GLib_DBusArgInfo.cs',
    'GLib_DBusSendMessageFlags.cs',
    'GLib_DBusObjectManagerClientFlags.cs',
    'GLib_TlsCertificateFlags.cs',
    'GLib_IAppInfo.cs',
    'GLib_UnixFDList.cs',
    'GLib_ITlsServerConnection.cs',
    'GLib_SocketType.cs',
    'GLib_TlsDatabaseLookupFlags.cs',
    'GLib_Application.cs',
    'GLib_DBusInterface.cs',
    'GLib_HttpsProxy.cs',
    'GLib_OutputStream.cs',
    'GLib_TlsConnection.cs',
    'GLib_DBusMessageClass.cs',
    'GLib_ThemedIcon.cs',
    'GLib_IOErrorEnum.cs',
    'GLib_DBusServerFlags.cs',
    'GLib_TcpWrapperConnection.cs',
    'GLib_BusNameWatcherFlags.cs',
    'GLib_GLibSharp.IOSchedulerJobFuncNative.cs',
    'GLib_SocketProtocol.cs',
    'GLib_DummyTlsDatabase.cs',
    'GLib_TlsFileDatabase.cs',
    'GLib_SeekableAdapter.cs',
    'GLib_NetworkMonitor.cs',
    'GLib_DtlsServerConnection.cs',
    'GLib_SocketAddressEnumerator.cs',
    'GLib_CommandLineHandler.cs',
    'GLib_CocoaNotificationBackend.cs',
    'GLib_ConverterResult.cs',
    'GLib_TlsCertificateRequestFlags.cs',
    'GLib_MenuAttributeIter.cs',
    'GLib_IOError.cs',
    'GLib_TlsServerConnectionAdapter.cs',
    'GLib_SocketFamily.cs',
    'GLib_RunHandler.cs',
    'GLib_Win32AppInfoURLSchema.cs',
    'GLib_DBusObjectManager.cs',
    'GLib_MountAddedHandler.cs',
    'GLib_AskPasswordFlags.cs',
    'GLib_LocalFileIOStream.cs',
    'GLib_FileMonitorEvent.cs',
    'GLib_NativeSocketAddress.cs',
    'GLib_FileReadMoreCallback.cs',
    'GLib_EmblemOrigin.cs',
    'GLib_IOModule.cs',
    'GLib_VolumeAdapter.cs',
    'GLib_Subprocess.cs',
    'GLib_PortalNotificationBackend.cs',
    'GLib_OutputVector.cs',
    'GLib_SocketMsgFlags.cs',
    'GLib_LoadableIconAdapter.cs',
    'GLib_DataStreamNewlineType.cs',
    'GLib_VolumeChangedHandler.cs',
    'GLib_AskPasswordHandler.cs',
    'GLib_SubprocessFlags.cs',
    'GLib_FileAttributeInfo.cs',
    'GLib_BufferedInputStream.cs',
    'GLib_GLibSharp.SpawnChildSetupFuncNative.cs',
    'GLib_VolumeMonitor.cs',
    'GLib_DBusMethodInvocationClass.cs',
    'GLib_MenuLinkIter.cs',
    'GLib_ReplyHandler.cs',
    'GLib_PasswordSave.cs',
    'GLib_DBusInterfaceInfo.cs',
    'GLib_ResolverRecordType.cs',
    'GLib_Win32AppInfoFileExtensionClass.cs',
    'GLib_MountMountFlags.cs',
    'GLib_FilesystemPreviewType.cs',
    'GLib_DatagramBasedAdapter.cs',
    'GLib_ChangedHandler.cs',
    'GLib_TlsError.cs',
    'GLib_TlsCertificate.cs',
    'GLib_Resolver.cs',
    'GLib_SocketControlMessage.cs',
    'GLib_DataInputStream.cs',
    'GLib_MountAdapter.cs',
    'GLib_SocketConnection.cs',
    'GLib_DummyDtlsConnection.cs',
    'GLib_DBusInterfaceSkeletonFlags.cs',
    'GLib_IAsyncInitable.cs',
    'GLib_SimpleAsyncThreadFunc.cs',
    'GLib_TlsInteractionResult.cs',
    'GLib_InitableAdapter.cs',
    'GLib_DBusObjectManagerServer.cs',
    'GLib_UnixConnection.cs',
    'GLib_TlsPasswordFlags.cs',
    'GLib_ActionEnabledChangedHandler.cs',
    'GLib_GLibSharp.ReallocFuncNative.cs',
    'GLib_Win32AppInfoFileExtension.cs',
    'GLib_ZlibCompressorFormat.cs',
    'GLib_UnixSocketAddressType.cs',
    'GLib_InetAddressMask.cs',
    'GLib_MenuExporter.cs',
    'GLib_BusType.cs',
    'GLib_EventHandler.cs',
    'GLib_Win32AppInfoHandlerClass.cs',
    'GLib_TlsRehandshakeMode.cs',
    'GLib_FileIcon.cs',
    'GLib_SettingsBackend.cs',
    'GLib_ITlsClientConnection.cs',
    'GLib_ResourceFileEnumeratorClass.cs',
    'GLib_ResourceFlags.cs',
    'GLib_DBusObjectManagerClient.cs',
    'GLib_Socks4Proxy.cs',
    'GLib_DBusMessageByteOrder.cs',
    'GLib_SrvTarget.cs',
    'GLib_CharsetConverter.cs',
    'GLib_DriveStopButtonHandler.cs',
    'GLib_Emblem.cs',
    'GLib_DummyTlsConnectionClass.cs',
    'GLib_WritableChangeEventHandler.cs',
    'GLib_DummyDtlsConnectionClass.cs',
    'GLib_GtkNotificationBackend.cs',
    'GLib_FileMonitor.cs',
    'GLib_AppInfoMonitor.cs',
    'GLib_IOStreamSpliceFlags.cs',
    'GLib_FileInputStream.cs',
    'GLib_DBusSubtreeVTable.cs',
    'GLib_InputVector.cs',
    'GLib_DtlsClientConnection.cs',
    'GLib_ActionAddedHandler.cs',
    'GLib_GLibSharp.TaskThreadFuncNative.cs',
    'GLib_AppInfoCreateFlags.cs',
    'GLib_TlsInteraction.cs',
    'GLib_ReallocFunc.cs',
    'GLib_UnixCredentialsMessage.cs',
    'GLib_ResolverError.cs',
    'GLib_Settings.cs',
    'GLib_GLibSharp.SettingsBindSetMappingNative.cs',
    'GLib_IConverter.cs',
    'GLib_DBusMessage.cs',
    'GLib_SettingsBindGetMapping.cs',
    'GLib_MountUnmountFlags.cs',
    'GLib_IOSchedulerJobFunc.cs',
    'GLib_SimpleIOStream.cs',
    'GLib_IconAdapter.cs',
    'GLib_DBusConnectionFlags.cs',
    'GLib_SocketSourceFunc.cs',
    'GLib_GLibSharp.FileMeasureProgressCallbackNative.cs',
    'GLib_TestDBusClass.cs',
    'GLib_FileEnumerator.cs',
    'GLib_AppLaunchContext.cs',
    'GLib_Task.cs',
    'GLib_DBusProxy.cs',
    'GLib_ProxyResolverAdapter.cs',
    'GLib_DBusActionGroup.cs',
    'GLib_SettingsBindSetMapping.cs',
    'GLib_DriveChangedHandler.cs',
    'GLib_FileCreateFlags.cs',
    'GLib_PollableInputStream.cs',
    'GLib_ResourceError.cs',
    'GLib_MenuExporterRemote.cs',
    'GLib_ExportedSubtree.cs',
    'GLib_ApplicationFlags.cs',
    'GLib_ProxyResolverPortal.cs',
    'GLib_GioGlobal.cs',
    'GLib_GLibSharp.SimpleAsyncThreadFuncNative.cs',
    'GLib_DBusConnection.cs',
    'GLib_Socket.cs',
    'GLib_TlsClientConnectionAdapter.cs',
    'GLib_GLibSharp.Win32RegistryKeyWatchCallbackFuncNative.cs',
    'GLib_Win32AppInfoURLSchemaClass.cs',
    'GLib_IIcon.cs',
    'GLib_MountOperationResult.cs',
    'GLib_VolumeRemovedHandler.cs',
    'GLib_ProxyAdapter.cs',
    'GLib_SubprocessLauncher.cs',
    'GLib_ResourceLookupFlags.cs',
    'GLib_InetAddress.cs',
    'GLib_SimpleActionGroup.cs',
    'GLib_FileAttributeMatcher.cs',
    'GLib_NetworkConnectivity.cs',
    'GLib_ConverterFlags.cs',
    'GLib_DBusMessageHeaderField.cs',
    'GLib_IVolume.cs',
    'GLib_FileAdapter.cs',
    'GLib_Notification.cs',
    'GLib_DBusProxyTypeFunc.cs',
    'GLib_IOExtensionPoint.cs',
    'GLib_TcpConnection.cs',
    'GLib_Win32AppInfoHandler.cs',
    'GLib_DummyProxyResolver.cs',
    'GLib_TlsPassword.cs',
    'GLib_DataStreamByteOrder.cs',
    'GLib_DBusPropertyInfo.cs',
    'GLib_ISocketConnectable.cs',
    'GLib_OpenedHandler.cs',
    'GLib_IProxyResolver.cs',
    'GLib_ActionStateChangedHandler.cs',
    'GLib_FilterOutputStream.cs',
    'GLib_SocketClientEvent.cs',
    'GLib_IOStreamAdapter.cs',
    'GLib_VfsFileLookupFunc.cs',
    'GLib_NotificationPriority.cs',
    'GLib_InputMessage.cs',
    'GLib_ApplicationCommandLine.cs',
    'GLib_Cancellable.cs',
    'GLib_DBusObjectProxy.cs',
    'GLib_DBusSignalFlags.cs',
    'GLib_InetSocketAddress.cs',
    'GLib_Win32RegistryValueType.cs',
    'GLib_SchemaState.cs',
    'GLib_DBusAuthObserver.cs',
    'GLib_Win32RegistryKeyWatcherFlags.cs',
    'GLib_IActionGroup.cs',
    'GLib_Win32AppInfoApplicationClass.cs',
    'GLib_DatagramBasedSourceFunc.cs',
    'GLib_PollableSourceFunc.cs',
    'GLib_GLibSharp.GSourceFuncNative.cs',
    'GLib_Pollable.cs',
    'GLib_ZlibCompressor.cs',
    'GLib_DtlsConnection.cs',
    'GLib_GLibSharp.DatagramBasedSourceFuncNative.cs',
    'GLib_ExportedObject.cs',
    'GLib_TestDBusFlags.cs',
    'GLib_MenuExporterMenu.cs',
    'GLib_BusNameOwnerFlags.cs',
    'GLib_DBusNodeInfo.cs',
    'GLib_GLibSharp.VfsFileLookupFuncNative.cs',
    'GLib_NetworkService.cs',
    'GLib_DBusMethodInvocation.cs',
    'GLib_FileMonitorFlags.cs',
    'GLib_DBusConnectionClass.cs',
    'GLib_DBusInterfaceVTable.cs',
    'GLib_IProxy.cs',
    'GLib_IActionMap.cs',
    'GLib_Resources.cs',
    'GLib_SimplePermission.cs',
    'GLib_IFile.cs',
    'GLib_LaunchedHandler.cs',
    'GLib_NextstepSettingsBackend.cs',
    'GLib_VolumeAddedHandler.cs',
    'GLib_OutputStreamSpliceFlags.cs',
    'GLib_BufferedOutputStream.cs',
    'GLib_PollableOutputStream.cs',
    'GLib_FileCopyFlags.cs',
    'GLib_AskQuestionHandler.cs',
    'GLib_SimpleAsyncResult.cs',
    'GLib_IMount.cs',
    'GLib_DBusMenuGroup.cs',
    'GLib_FilenameCompleter.cs',
    'GLib_IOModuleScopeFlags.cs',
    'GLib_Permission.cs',
    'GLib_MountChangedHandler.cs',
    'GLib_DriveEjectButtonHandler.cs',
    'GLib_DummyTlsDatabaseClass.cs',
    'GLib_ProxyAddress.cs',
    'GLib_FileAttributeStatus.cs',
    'GLib_IInitable.cs',
    'GLib_MessageToWriteData.cs',
    'GLib_FileOutputStream.cs',
    'GLib_GLibSharp.FileReadMoreCallbackNative.cs',
    'GLib_Vfs.cs',
    'GLib_FileAttributeInfoList.cs',
    'GLib_DriveStartStopType.cs',
    'GLib_ActionEntry.cs',
    'GLib_Win32RegistryKey.cs',
    'GLib_NotificationBackend.cs',
    'GLib_IncomingHandler.cs',
    'GLib_HttpProxy.cs',
    'GLib_MountPreUnmountHandler.cs',
    'GLib_SocketConnectableAdapter.cs',
    'GLib_SimpleAction.cs',
    'GLib_ActionAdapter.cs',
    'GLib_FileQueryInfoFlags.cs',
    'GLib_FilterInputStream.cs',
    'GLib_GLibSharp.SettingsGetMappingNative.cs',
    'GLib_ILoadableIcon.cs',
    'GLib_TlsAuthenticationMode.cs',
    'GLib_GLibSharp.DBusProxyTypeFuncNative.cs',
    'GLib_FileAttributeType.cs',
    'GLib_AsyncReadyCallback.cs',
    'GLib_DBusCapabilityFlags.cs',
    'GLib_AppInfoAdapter.cs',
    'GLib_RemoteActionGroup.cs',
    'GLib_IAction.cs',
]

run_target('update_' + pkg + '_code',
        command: [
            generate_api,
            '--api-raw', raw_api_fname,
            '--gapi-fixup', gapi_fixup.full_path(),
            '--metadata', metadata_fname,
            '--gapi-codegen', gapi_codegen.full_path(),
            '--extra-includes', glib_api_includes,
            '--out', meson.current_source_dir(),
            '--files', ';'.join(generated_sources),
            '--assembly-name', assembly_name,
            '--schema', schema,
        ],
        depends: [gapi_codegen, gapi_fixup],)
pkgs += [pkg]
source_gen = files(generated_sources)
gio_api_includes = join_paths(meson.current_source_dir(), 'gio-api.xml')
if install
    install_data(gio_api_includes, install_dir: gapi_xml_installdir)
endif
